﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using ST.Buz.Base.Entity;

namespace ST.Buz.Base.Mapping
{
	public partial class Map_Sys_UserRole : IEntityTypeConfiguration<Sys_UserRole>
	{
		public void Configure(EntityTypeBuilder<Sys_UserRole> builder)
		{
			builder.HasIndex(e => new { e.UserID, e.RoleID })
				.IsUnique(true)
				.HasName("IX_Sys_UserRole_UserID_RoleID")
				.IsClustered(false);

			builder.Property(m => m.Sort)
				.HasDefaultValueSql("((0))")
				.ValueGeneratedNever();

			builder.Property(e => e.AuthValid)
				.HasDefaultValueSql("('1')")
				.ValueGeneratedNever();

			builder.Property(e => e.AddManID)
				.HasDefaultValueSql("((0))")
				.ValueGeneratedNever();

			builder.Property(e => e.AddDate)
				.HasDefaultValueSql("(getdate())")
				.ValueGeneratedNever();
		}
	}
}
